package com.viknix.threadpool.manager.common.util;

import com.alibaba.fastjson.JSON;
import com.viknix.threadpool.manager.common.constant.Constants;
import com.viknix.threadpool.manager.common.model.PoolParameterInfo;

/**
 * @Author: Dongqi
 * @Date: 2021/10/24 19:23
 * @Version 1.0
 * @Description: ContentUtil
 */
public class ContentUtil {

    public static String getPoolContent(PoolParameterInfo parameter) {
        return JSON.toJSONString(parameter);
    }

    public static String getGroupKey(PoolParameterInfo parameter) {
        StringBuilder stringBuilder = new StringBuilder();
        String resultStr = stringBuilder.append(parameter.getThreadPoolId())
                .append(Constants.GROUP_KEY_DELIMITER)
                .append(parameter.getItem())
                .append(Constants.GROUP_KEY_DELIMITER)
                .append(parameter.getNamespace())
                .toString();
        return resultStr;
    }
}
